<?php

class Visitas_M extends I_Model {

    protected $_table_name = 'visitas_lotes';
    protected $_primary_key = 'VISITA_ID';
    protected $_primary_filter = 'intval';
    protected $_order_by = 'VISITA_ID';
    public $rules = array();
    protected $_timestamps = FALSE;

    public function __construct() {
        parent::__construct();
    }
    
    /*
     *  update
     *  @param $id codigo do leilao
     *  @return void
     * 
     */
    
    function update($id){
    	$row = $this->get_by(array('LOTE_ID'=>$id));
    	$data['COUNT'] = 1;
    	$data['LOTE_ID'] =  $id;
    	$id =  null;
    	if($row){
    		$data['COUNT'] =  $row['0']->COUNT + 1;
    		$id = $row['0']->VISITA_ID;
    		
    	}
    	$this->save($data,$id);
    }

   
	 
    
}
